﻿Public Module ModuleAlbum

	Sub AddToListView(ByRef albums() As Album, ByRef listview As ListView)
		If IsNothing(albums) Then
			Return
		End If


		Dim art As New PictureBox

		For Each album As Album In albums
			'If album.mbid <> "" Then
			Dim item As ListViewItem = GenerateListViewItemSearch(album.name, album.artist, album.name, album.mbid, 0, listview.Groups("Albums"))

			If Not (IsNothing(album.image)) Then
				If album.image(1) <> Nothing Then
					art.Load(album.image(1))
					listview.SmallImageList.Images.Add(art.Image)
					item.ImageIndex = listview.SmallImageList.Images.Count - 1
				End If
			End If

			listview.Items.Add(item)
			'End If
		Next

		listview.LargeImageList = listview.SmallImageList
		art.Dispose()
	End Sub


End Module
